package com.museum.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.museum.base.BaseApiService;
import com.museum.entity.DO.Token;
import com.museum.mapper.TokenMapper;
import com.museum.service.api.TokenServiceAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author LB
 * @version 1.0
 * @date 2020/12/25 16:50
 */
@Service
public class TokenServiceImpl extends BaseApiService<JSONObject> implements TokenServiceAPI {


    @Autowired
    private TokenMapper tokenMapper;


    @Override
    public Token isExit(Integer userID) {
        return tokenMapper.isExit(userID);
    }
  /**
   * @param
   * @Desciption 更新旧的token
   * @return
   */
    @Override
    public int updateById(Token oldToken) {
        return tokenMapper.updateById(oldToken);
    }

    @Override
    public int logout(String token) {
        return tokenMapper.logout(token);
    }

    @Override
    public int insert(Token newToken) {
        return tokenMapper.insert(newToken);
    }
}
